
public class Stack_ImplListe implements Stack {
	private Node stack;
	private Node neu;
	
	@Override
	public boolean push(Element obj) {
		if(stack == null) {
			stack = new Node();
			stack.setItem(obj);
			return true;
		} else {
			neu = new Node();
			neu.setItem(obj);
			neu.setNext(stack);
			stack = neu;
			return true;
		}
	}

	@Override
	public Element pop() {
		if(!empty()) { 
			Element el = stack.getItem();
			stack = stack.getNext();
			return el;
		}
		return null;
	}

	@Override
	public Element top() {
		if(stack != null)
			return stack.getItem();
		return null;
	}

	@Override
	public boolean empty() {
		if(stack == null)
			return true;
		return false;
	}

}
